<template>
    <div>
        <h2>等级显示页面</h2>
        <input type="button" value="新增" class="btn btn-primary" @click="ok">
        <table class="table tale-bordered">
            <tbody>
                <tr>
                    <td>编号</td>
                    <td>等级名</td>
                </tr>
                <tr v-for="item in data.list" :key="item.Id">
                    <td>{{item.Id}}</td>
                    <td>{{item.LevelName}}</td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import {ref,reactive,onMounted} from 'vue'
import axios from 'axios';
import { useRouter } from 'vue-router';
const router=useRouter();

const ok=()=>{
    router.push('/');
}

const data:any=reactive({
    list:[]
})

onMounted(()=>{
    showlist();
})

const showlist=()=>{
    axios({
        method:"get",
        url:"/api/User/ShowList"
    })
    .then(res=>{
        console.log(res);
        data.list=res.data;
    })
    .catch(err=>{
        console.error(err);
    })
}
</script>

<style scoped>

</style>